package com.wawayaya.ui.widget;


import android.content.Context;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.wawayaya.bean.Advert;
import com.wawayaya.bean.HomePage;
import com.wawayaya.ui.advertcover.AdvertCoverAdapter;
import java.util.List;
import wawayaya.kids_iread.R;

/**
 * 广告 书架 当前 行布局,根据数据动态生成
 * 分为两种类型
 * 1. 显示 图书   最多 5个item
 * 2. 显示广告栏  最多 3 个item
 */
public class AdvertRack {

	private Context context = null;

	private View m_v = null;
	private RecyclerView       recyclerView = null;
    private AdvertCoverAdapter advertCoverAdapter;

    private List<Advert> advertList;
    private  boolean   isZh;

	public AdvertRack(
			Context context,
			View v,
			final HomePage homePage) {
		this.m_v = v;
        this.context = context;
		this.advertList = homePage.getAdverts();

		this.initView();
        this.setListener();
        this.loadData();
	}

	private void initView(){
		recyclerView = (RecyclerView)m_v.findViewById(R.id.rv_advert_rack);

		GridLayoutManager gridLayoutManager=new GridLayoutManager(context, 3);

		recyclerView.setLayoutManager(gridLayoutManager);

		recyclerView.setHasFixedSize(true);

		advertCoverAdapter = new AdvertCoverAdapter(context,isZh,advertList);
		recyclerView.setAdapter(advertCoverAdapter);
	}

	public View getView() {
		return m_v;
	}


	private void  setListener(){

	}

	private void  loadData(){

	}


	
}
